Skip to content

feat(generate): emit cascade-hotfix workflow for multi-env repos#106

Merged
joshua-temple merged 1 commit into
mainfrom
feat/hotfix-workflow-generator
Jun 11, 2026
Merged

feat(generate): emit cascade-hotfix workflow for multi-env repos#106
joshua-temple merged 1 commit into
mainfrom
feat/hotfix-workflow-generator

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

Multi-environment repos need a generated workflow to hotfix a trunk fix onto a diverged intermediate environment. The pieces existed in the CLI (cascade hotfix plan/finalize, divergence state, promotion guards) but nothing emitted the orchestrating workflow.

Fix

New HotfixGenerator renders .github/workflows/cascade-hotfix.yaml, wired into generate-workflow beside the other auxiliary generators. It emits only when two or more environments are configured (below that, direct promotion already covers every case); target_env is the configured environments minus the build target.

Two triggers in one file: workflow_dispatch (inputs commit, target_env choice, pr_number replay, dry_run) and pull_request: types: [closed] on env/*, gated on merge plus the cascade-hotfix label. Jobs: plan, apply, check, context, build, deploy, rollback, finalize, with concurrency: hotfix-<env>.

  • Clean cherry-pick: push, open a labeled PR, enable auto-merge.
  • Conflict: commit the markers, open a cascade-hotfix-conflict PR with the conflicting-file list, resolve-locally instructions, and machine-readable trailers (Cascade-Hotfix-Target/Source/Base).
  • The deploy job binds the GitHub environment: of the target env so org protection rules gate production hotfixes.
  • A non-failing branch-protection check warns when env/* has no required status checks and prints the exact configuration command.
  • Plan protection suggestions surface as notices.
  • finalize runs only on deploy success.

Verification

  • go build ./... clean
  • go test ./... clean (17 new golden tests in internal/generate, including an actionlint pass over the generated output)
  • go vet ./... clean
  • golangci-lint run ./internal/generate/... reports 0 issues
  • actionlint runs clean over the emitted workflow

Notes

  • cascade's own manifest defines no environments, so the generator correctly emits nothing for this repo; there is no committed cascade-hotfix.yaml to regenerate.
  • rollback_sha sourcing is left as a placeholder output; the rollback job shape, environment binding, and with: sha plumbing mirror the promote workflow and activate once a CLI output supplies the value.
  • The act/gitea hotfix end-to-end scenarios are owned by a separate unit and are intentionally not added here.

Add a HotfixGenerator that renders .github/workflows/cascade-hotfix.yaml,
wired into generate-workflow beside the other auxiliary generators. The
workflow cherry-picks a trunk fix onto a diverged intermediate environment
through an env/<env> integration branch, opens a resolution pull request,
and on merge builds, deploys, and finalizes the hotfix.

The generator emits only when two or more environments are configured;
target_env is the configured environments minus the build target. Dual
triggers cover manual dispatch and merged env/* pull requests. Clean
cherry-picks auto-merge with the cascade-hotfix label; conflicting ones
commit the markers and open a cascade-hotfix-conflict pull request carrying
machine-readable trailers and resolve-locally instructions. The deploy job
binds the GitHub environment of the target so org protection rules gate
production hotfixes, branch protection is verified with a non-failing
warning, and plan protection suggestions surface as notices.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple joshua-temple merged commit 0378876 into main Jun 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant